//package edu.faytechcc.csc251.gui;
//
//import edu.faytechcc.csc251.db.MTGDBQuery;
//import java.awt.*;
//import java.awt.event.ActionEvent;
//import java.awt.event.ActionListener;
//import javax.swing.*;
///**
// *
// * @author kent
// */
//public class OldPanel extends JFrame
//{
//
//    private JPanel mainPanel;
//    private JPanel leftPanel;
//    private JPanel rightPanel;
//    private ResultsPanel resultsPanel;
//    private JPanel buttonPanel;
//    private JPanel searchPanel;
//    private JPanel filterPanel;
//    private JPanel previewPanel;
//    private JButton addButton;
//    private JButton deckButton;
//    private JTextField searchText;
//    private JButton searchButton;
//    private String[] filterArray =
//    {
//        "Artifact", "Creature",
//        "Enchantment", "Instant", "Land", "Planeswalker",
//        "Sorcery", "Tribal"
//    };
//    private JCheckBox[] filterBoxes = new JCheckBox[filterArray.length];
//    private JButton filterButton;
//    private JLabel imageLabel;
//
//    public OldPanel()
//    {
//
//        this.setTitle("MTG Database");
//
//        this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
//
//        this.buildMainPanel();
//
//        this.add(mainPanel);
//
//        this.pack();
//
//        this.setVisible(true);
//    }
//
//    private void buildMainPanel()
//    {
//        //Create main panel and set a border.
//        mainPanel = new JPanel(new BorderLayout());
//        mainPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
//
//        //Create the left side
//        leftPanel = new JPanel(new BorderLayout());
//        
//        resultsPanel = new ResultsPanel();
//        buildButtonPanel();
//        leftPanel.add(resultsPanel, BorderLayout.CENTER);
//        leftPanel.add(buttonPanel, BorderLayout.SOUTH);
//
//        //Create the right side
//        rightPanel = new JPanel(new BorderLayout());
//        buildSearchPanel();
//        rightPanel.add(searchPanel, BorderLayout.NORTH);
//        buildFilterPanel();
//        rightPanel.add(filterPanel, BorderLayout.CENTER);
//        buildPreviewPanel();
//        rightPanel.add(previewPanel, BorderLayout.SOUTH);
//
//        //Add everything to the main panel.
//        mainPanel.add(leftPanel, BorderLayout.CENTER);
//        mainPanel.add(rightPanel, BorderLayout.EAST);
//
//    }
//    public void buildButtonPanel()
//    {
//        buttonPanel = new JPanel();
//        addButton = new JButton("Add");
//        deckButton = new JButton("Add to Deck");
//        buttonPanel.add(addButton);
//        buttonPanel.add(deckButton);
//    }
//
//    public void setButtonPanel(JPanel panel)
//    {
//       this.buttonPanel = panel;
//    }
//
//    private void buildSearchPanel()
//    {
//        searchPanel = new JPanel();
//        searchPanel.setBorder(BorderFactory.createTitledBorder("Search"));
//        searchText = new JTextField(20);
//        searchPanel.add(searchText);
//        searchButton = new JButton("Search");
//        searchPanel.add(searchButton);
//    }
//
//    private void buildFilterPanel()
//    {
//        filterPanel = new JPanel(new GridLayout(3, 0));
//        filterPanel.setBorder(BorderFactory.createTitledBorder("Filter"));
//        for (int i = 0; i < filterBoxes.length; i++)
//        {
//            filterBoxes[i] = new JCheckBox();
//            filterBoxes[i].setText(filterArray[i]);
//            filterPanel.add(filterBoxes[i]);
//        }
//        filterButton = new JButton("Filter");
//        filterButton.addActionListener(new FilterButtonListener());
//        filterPanel.add(filterButton);
//    }
//
//    public void buildPreviewPanel()
//    {
//        previewPanel = new JPanel();
//        //previewPanel.setLayout(new BorderLayout());
//        previewPanel.setBorder(BorderFactory.createTitledBorder("Preview"));
//        ImageIcon cardImage = new ImageIcon("cardBack.jpg");
//        imageLabel = new JLabel();
//        imageLabel.setIcon(cardImage);
//        previewPanel.add(imageLabel);
//    }
//public class FilterButtonListener implements ActionListener
//    {
//        
//        @Override
//        public void actionPerformed(ActionEvent e)
//        {
//            String query = "SELECT * FROM Card WHERE Type LIKE";
//            for (int i = 0; i < filterBoxes.length; i++)
//            {
//                if( filterBoxes[i].isSelected())
//                {
//                    query += " '%" + filterBoxes[i].getText() + "%' OR Type LIKE";
//                }
//            }
//            query = query.substring(0, query.length() - 12);
//            System.out.println(query);
//            MTGDBQuery dbQuery = new MTGDBQuery(query);
//            resultsPanel.setModelData(dbQuery.getTableData());
//        }
//        
//    }
//   
//
//   
//    }
